#delimit;
clear;
set more off;
log using pc_gsp93.log, replace;

/*****************************************************
This program produces results for column (6) of 
Table 2.
This program creates per capita GSP for the year 1993.
The 1993 population comes from the Census data.
******************************************************/

use GSP.dta;
keep if year==1993;
replace gsp=gsp*1000000;
*** deflating by nominal exchange rate between peso and US dollar;
*** I am using the average nominal exchange rate for 1993;
*** Statistics are obtained from <http://www.banrep.gov.co/statistics/sta_exchange.htm#1992>;
replace gsp=gsp/788.69; 
keep dep_ocu departamento gsp;
gen pop=.;
replace pop=4945448 if dep_ocu==11;
replace pop=37764 if dep_ocu==91;
replace pop=4342347 if dep_ocu==5;
replace pop=137193 if dep_ocu==81;
replace pop=1667500 if dep_ocu==8;
replace pop=1174031 if dep_ocu==15;
replace pop=925358 if dep_ocu==17;
replace pop=158149 if dep_ocu==85;
replace pop=338160 if dep_ocu==27;
replace pop=1088087 if dep_ocu==23;
replace pop=1658698 if dep_ocu==25;
replace pop=758013 if dep_ocu==41;
replace pop=435018 if dep_ocu==63;
replace pop=744974 if dep_ocu==66;
replace pop=50094 if dep_ocu==88;
replace pop=1598688 if dep_ocu==68;
replace pop=624463 if dep_ocu==70;
replace pop=1150080 if dep_ocu==73;
replace pop=3333150 if dep_ocu==76;
replace pop=1439291 if dep_ocu==13;
replace pop=979231 if dep_ocu==19;
replace pop=57884 if dep_ocu==95;
replace pop=1274708 if dep_ocu==52;
replace pop=204309 if dep_ocu==86;
replace pop=18235 if dep_ocu==97;
replace pop=36336 if dep_ocu==99;
replace pop=311464 if dep_ocu==18;
replace pop=561121 if dep_ocu==50;
replace pop=729634 if dep_ocu==20;
replace pop=13491 if dep_ocu==94;
replace pop=387773 if dep_ocu==44;
replace pop=882571 if dep_ocu==47;
replace pop=1046577 if dep_ocu==54;

gen pc_gsp93=gsp/pop;
sort dep_ocu;
list dep_ocu departamento pop pc_gsp93;
save pc_gsp93.dta, replace;


*** all non-growing;
clear;
use pc_gsp93;
gen non_grow1=0;
replace non_grow1=1 if dep_ocu==11 | dep_ocu==91 | dep_ocu==5 | dep_ocu==81 | dep_ocu==8 |
                       dep_ocu==15 | dep_ocu==17 | dep_ocu==85 | dep_ocu==27 | dep_ocu==23 |
                       dep_ocu==25 | dep_ocu==41 | dep_ocu==63 | dep_ocu==66 | dep_ocu==88 |
                       dep_ocu==68 | dep_ocu==70 | dep_ocu==73 | dep_ocu==76;
bysort non_grow1: egen tot_pop=sum(pop);
bysort non_grow1: egen tot_gsp=sum(gsp);
keep non_grow1 tot_pop tot_gsp;
duplicates drop;
gen tot_pc_gsp93=tot_gsp/tot_pop;
list non_grow1 tot_pop tot_pc_gsp93;


*** all non-growing except Bogota, Antiquia, and Valle de Cauca;
clear;
use pc_gsp93;
gen non_grow2=0;
replace non_grow2=1 if dep_ocu==91 | dep_ocu==81 | dep_ocu==8 |
                       dep_ocu==15 | dep_ocu==17 | dep_ocu==85 | dep_ocu==27 | dep_ocu==23 |
                       dep_ocu==25 | dep_ocu==41 | dep_ocu==63 | dep_ocu==66 | dep_ocu==88 |
                       dep_ocu==68 | dep_ocu==70 | dep_ocu==73;
bysort non_grow2: egen tot_pop=sum(pop);
bysort non_grow2: egen tot_gsp=sum(gsp);
keep non_grow2 tot_pop tot_gsp;
duplicates drop;
gen tot_pc_gsp93=tot_gsp/tot_pop;
list non_grow2 tot_pop tot_pc_gsp93;

*** 9 growing;
clear;
use pc_gsp93;
gen grow9=0;
replace grow9=1 if dep_ocu==13 | dep_ocu==19 | dep_ocu==95 | dep_ocu==52 | dep_ocu==86 |
                   dep_ocu==97 | dep_ocu==99;
bysort grow9: egen tot_pop=sum(pop);
bysort grow9: egen tot_gsp=sum(gsp);
keep grow9 tot_pop tot_gsp;
duplicates drop;
gen tot_pc_gsp93=tot_gsp/tot_pop;
list grow9 tot_pop tot_pc_gsp93;


*** DMZ;
clear;
use pc_gsp93;
gen dmz=0;
replace dmz=1 if dep_ocu==18 | dep_ocu==50;
bysort dmz: egen tot_pop=sum(pop);
bysort dmz: egen tot_gsp=sum(gsp);
keep dmz tot_pop tot_gsp;
duplicates drop;
gen tot_pc_gsp93=tot_gsp/tot_pop;
list dmz tot_pop tot_pc_gsp93;


*** medium producers;
clear;
use pc_gsp93;
gen medium=0;
replace medium=1 if dep_ocu==20 | dep_ocu==94 | dep_ocu==44 | dep_ocu==47 | dep_ocu==54;
bysort medium: egen tot_pop=sum(pop);
bysort medium: egen tot_gsp=sum(gsp);
keep medium tot_pop tot_gsp;
duplicates drop;
gen tot_pc_gsp93=tot_gsp/tot_pop;
list medium tot_pop tot_pc_gsp93;


*** All departments;
clear;
use pc_gsp93;
egen tot_pop=sum(pop);
egen tot_gsp=sum(gsp);
keep tot_pop tot_gsp;
duplicates drop;
gen tot_pc_gsp93=tot_gsp/tot_pop;
list tot_pop tot_pc_gsp93;

erase pc_gsp93.dta;

log close;
